<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    // 对象赋值
    var a = {
      a: 123,
      name: 'xxx'
    }
    var b = a;
    b.name = 'zzz',
      console.log(a);
    console.log(b);
    // 浅拷贝
    var num = [1, 2, 3, 4, 5, { n: 'name' }]
    var arr = num.slice()
    // slice(1)括号里面的值，是从那个位置开始拷贝
    // arr.push(10)
    arr[5].n = ' nameee'
    console.log(num);

    console.log(arr);

    // let arr = [1, 3, {
    //   username: ' kobe'
    // }];
    // let arr3 = arr.slice();
    // arr3[2].username = 'wade'
    // console.log(arr);
    // console.log(arr3);

  </script>
</body>

</html>